const http = require('http');
const url = require('url');

let server = http.createServer();

server.on('request',(req,res)=>{
  if(req.url.startsWith('/jsonp')) {
    // 1:获取传递来的回调函数名
    let callbackName = url.parse(req.url,true).query.callback;
    //callbackName = 'myjsonp_1234xxx'
    let findData = '机密数据';
    res.end(`${callbackName}('${findData}')`);
  }
});

server.listen(8888);